home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / Tool Chest / Interfaces / UniversalInterfaces 2.1B1 / CIncludes / GXEnvironment.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-18  |  9.8 KB  |  288 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        GXEnvironment.h
  3.  
  4.      Contains:    QuickDraw GX environment constants and interfaces
  5.  
  6.      Version:    Technology:    Quickdraw GX 1.1
  7.                  Package:    Universal Interfaces 2.1ß1 in “MPW Prerelease” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __GXENVIRONMENT__
  21. #define __GXENVIRONMENT__
  22.  
  23.  
  24. #ifndef __CONDITIONALMACROS__
  25. #include <ConditionalMacros.h>
  26. #endif
  27.  
  28. #ifndef __MIXEDMODE__
  29. #include <MixedMode.h>
  30. #endif
  31. /*    #include <Types.h>                                            */
  32.  
  33. #ifndef __WINDOWS__
  34. #include <Windows.h>
  35. #endif
  36. /*    #include <Memory.h>                                            */
  37. /*    #include <Quickdraw.h>                                        */
  38. /*        #include <QuickdrawText.h>                                */
  39. /*    #include <Events.h>                                            */
  40. /*        #include <OSUtils.h>                                    */
  41. /*    #include <Controls.h>                                        */
  42. /*        #include <Menus.h>                                        */
  43.  
  44. #ifndef __GXTYPES__
  45. #include <GXTypes.h>
  46. #endif
  47. /*    #include <GXMath.h>                                            */
  48. /*        #include <FixMath.h>                                    */
  49.  
  50. #ifdef __cplusplus
  51. extern "C" {
  52. #endif
  53.  
  54. #if PRAGMA_ALIGN_SUPPORTED
  55. #pragma options align=mac68k
  56. #endif
  57.  
  58. #if PRAGMA_IMPORT_SUPPORTED
  59. #pragma import on
  60. #endif
  61.  
  62. #if defined(__MWERKS__) && GENERATING68K
  63.     #pragma push
  64.     #pragma pointers_in_D0
  65. #endif
  66.  
  67. #define graphicsMacintoshIncludes
  68. /* old header = graphics macintosh */
  69.  
  70.  
  71. enum {
  72.     defaultPollingHandlerFlags    = 0x00,
  73.     okToSwitchDuringPollFlag    = 0x00,
  74.     dontSwitchDuringPollFlag    = 0x01
  75. };
  76.  
  77. typedef long gxPollingHandlerFlags;
  78.  
  79. typedef void (*gxPollingHandlerProcPtr)(long reference, gxPollingHandlerFlags flags);
  80.  
  81. #if GENERATINGCFM
  82. typedef UniversalProcPtr gxPollingHandlerUPP;
  83. #else
  84. typedef gxPollingHandlerProcPtr gxPollingHandlerUPP;
  85. #endif
  86.  
  87. enum {
  88.     uppgxPollingHandlerProcInfo = kCStackBased
  89.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  90.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(gxPollingHandlerFlags)))
  91. };
  92.  
  93. #if GENERATINGCFM
  94. #define NewgxPollingHandlerProc(userRoutine)        \
  95.         (gxPollingHandlerUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxPollingHandlerProcInfo, GetCurrentArchitecture())
  96. #else
  97. #define NewgxPollingHandlerProc(userRoutine)        \
  98.         ((gxPollingHandlerUPP) (userRoutine))
  99. #endif
  100.  
  101. #if GENERATINGCFM
  102. #define CallgxPollingHandlerProc(userRoutine, reference, flags)        \
  103.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppgxPollingHandlerProcInfo, (reference), (flags))
  104. #else
  105. #define CallgxPollingHandlerProc(userRoutine, reference, flags)        \
  106.         (*(userRoutine))((reference), (flags))
  107. #endif
  108.  
  109. extern gxPollingHandlerUPP GXGetGraphicsPollingHandler(long *reference)
  110.  THREEWORDINLINE(0x303C, 0x245, 0xA832);
  111. extern void GXSetGraphicsPollingHandler(gxPollingHandlerUPP handler, long reference)
  112.  THREEWORDINLINE(0x303C, 0x246, 0xA832);
  113. #define graphicsToolboxIncludes
  114. /* old header = graphics toolbox */
  115.  
  116. /* QD to QD GX Translator typedefs */
  117.  
  118. enum gxTranslationOptions {
  119.     gxDefaultOptionsTranslation    = 0x0000,
  120.     gxOptimizedTranslation        = 0x0001,
  121.     gxReplaceLineWidthTranslation = 0x0002,
  122.     gxSimpleScalingTranslation    = 0x0004,
  123.     gxSimpleGeometryTranslation    = 0x0008,                        /* implies simple scaling */
  124.     gxSimpleLinesTranslation    = 0x000C,                        /* implies simple geometry & scaling */
  125.     gxLayoutTextTranslation        = 0x0010,                        /* turn on gxLine layout (normally off) */
  126.     gxRasterTargetTranslation    = 0x0020,
  127.     gxPostScriptTargetTranslation = 0x0040,
  128.     gxVectorTargetTranslation    = 0x0080
  129. };
  130.  
  131. typedef long gxTranslationOption;
  132.  
  133.  
  134. enum gxTranslationStatistics {
  135.     gxContainsFormsBegin        = 0x0001,
  136.     gxContainsFormsEnd            = 0x0002,
  137.     gxContainsPostScript        = 0x0004,
  138.     gxContainsEmptyPostScript    = 0x0008
  139. };
  140.  
  141. typedef long gxTranslationStatistic;
  142.  
  143.  
  144. enum {
  145.     gxQuickDrawPictTag            = 'pict'
  146. };
  147.  
  148. struct gxQuickDrawPict {
  149. /* translator inputs */
  150.     gxTranslationOption                options;
  151.     Rect                            srcRect;
  152.     Point                            styleStretch;
  153. /* size of quickdraw picture data */
  154.     unsigned long                    dataLength;
  155. /* file alias */
  156.     struct gxBitmapDataSourceAlias    alias;
  157. };
  158. typedef struct gxQuickDrawPict gxQuickDrawPict;
  159.  
  160. /* WindowRecord utilities */
  161. extern gxViewPort GXNewWindowViewPort(WindowPtr qdWindow)
  162.  THREEWORDINLINE(0x303C, 0x236, 0xA832);
  163. extern gxViewPort GXGetWindowViewPort(WindowPtr qdWindow)
  164.  THREEWORDINLINE(0x303C, 0x237, 0xA832);
  165. extern WindowPtr GXGetViewPortWindow(gxViewPort portOrder)
  166.  THREEWORDINLINE(0x303C, 0x238, 0xA832);
  167. /* GDevice utilities */
  168. extern GDHandle GXGetViewDeviceGDevice(gxViewDevice theDevice)
  169.  THREEWORDINLINE(0x303C, 0x239, 0xA832);
  170. extern gxViewDevice GXGetGDeviceViewDevice(GDHandle qdGDevice)
  171.  THREEWORDINLINE(0x303C, 0x23a, 0xA832);
  172. /* gxPoint utilities */
  173. extern void GXConvertQDPoint(const Point *shortPt, gxViewPort portOrder, gxPoint *fixedPt)
  174.  THREEWORDINLINE(0x303C, 0x23b, 0xA832);
  175. /* printing utilities typedef */
  176. typedef OSErr (*gxShapeSpoolProcPtr)(gxShape toSpool, long refCon);
  177. typedef void (*gxUserViewPortFilterProcPtr)(gxShape toFilter, gxViewPort portOrder, long refCon);
  178. typedef long (*gxConvertQDFontProcPtr)(gxStyle dst, long txFont, long txFace);
  179.  
  180. #if GENERATINGCFM
  181. typedef UniversalProcPtr gxShapeSpoolUPP;
  182. typedef UniversalProcPtr gxUserViewPortFilterUPP;
  183. typedef UniversalProcPtr gxConvertQDFontUPP;
  184. #else
  185. typedef gxShapeSpoolProcPtr gxShapeSpoolUPP;
  186. typedef gxUserViewPortFilterProcPtr gxUserViewPortFilterUPP;
  187. typedef gxConvertQDFontProcPtr gxConvertQDFontUPP;
  188. #endif
  189.  
  190. enum {
  191.     uppgxShapeSpoolProcInfo = kCStackBased
  192.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  193.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(gxShape)))
  194.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))),
  195.     uppgxUserViewPortFilterProcInfo = kCStackBased
  196.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(gxShape)))
  197.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(gxViewPort)))
  198.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))),
  199.     uppgxConvertQDFontProcInfo = kCStackBased
  200.          | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  201.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(gxStyle)))
  202.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long)))
  203.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long)))
  204. };
  205.  
  206. #if GENERATINGCFM
  207. #define NewgxShapeSpoolProc(userRoutine)        \
  208.         (gxShapeSpoolUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxShapeSpoolProcInfo, GetCurrentArchitecture())
  209. #define NewgxUserViewPortFilterProc(userRoutine)        \
  210.         (gxUserViewPortFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxUserViewPortFilterProcInfo, GetCurrentArchitecture())
  211. #define NewgxConvertQDFontProc(userRoutine)        \
  212.         (gxConvertQDFontUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxConvertQDFontProcInfo, GetCurrentArchitecture())
  213. #else
  214. #define NewgxShapeSpoolProc(userRoutine)        \
  215.         ((gxShapeSpoolUPP) (userRoutine))
  216. #define NewgxUserViewPortFilterProc(userRoutine)        \
  217.         ((gxUserViewPortFilterUPP) (userRoutine))
  218. #define NewgxConvertQDFontProc(userRoutine)        \
  219.         ((gxConvertQDFontUPP) (userRoutine))
  220. #endif
  221.  
  222. #if GENERATINGCFM
  223. #define CallgxShapeSpoolProc(userRoutine, toSpool, refCon)        \
  224.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppgxShapeSpoolProcInfo, (toSpool), (refCon))
  225. #define CallgxUserViewPortFilterProc(userRoutine, toFilter, portOrder, refCon)        \
  226.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppgxUserViewPortFilterProcInfo, (toFilter), (portOrder), (refCon))
  227. #define CallgxConvertQDFontProc(userRoutine, dst, txFont, txFace)        \
  228.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppgxConvertQDFontProcInfo, (dst), (txFont), (txFace))
  229. #else
  230. #define CallgxShapeSpoolProc(userRoutine, toSpool, refCon)        \
  231.         (*(userRoutine))((toSpool), (refCon))
  232. #define CallgxUserViewPortFilterProc(userRoutine, toFilter, portOrder, refCon)        \
  233.         (*(userRoutine))((toFilter), (portOrder), (refCon))
  234. #define CallgxConvertQDFontProc(userRoutine, dst, txFont, txFace)        \
  235.         (*(userRoutine))((dst), (txFont), (txFace))
  236. #endif
  237.  
  238. typedef gxShapeSpoolProcPtr gxShapeSpoolFunction;
  239.  
  240. typedef gxUserViewPortFilterProcPtr gxUserViewPortFilter;
  241.  
  242. typedef gxConvertQDFontProcPtr gxConvertQDFontFunction;
  243.  
  244. /* mouse utilities */
  245. /* return mouse location in fixed-gxPoint global space */
  246. extern void GXGetGlobalMouse(gxPoint *globalPt)
  247.  THREEWORDINLINE(0x303C, 0x23c, 0xA832);
  248. /* return fixed-gxPoint local mouse (gxViewPort == 0 --> default) */
  249. extern void GXGetViewPortMouse(gxViewPort portOrder, gxPoint *localPt)
  250.  THREEWORDINLINE(0x303C, 0x23d, 0xA832);
  251. /* printing utilities */
  252. extern gxUserViewPortFilter GXGetViewPortFilter(gxViewPort portOrder, long *refCon)
  253.  THREEWORDINLINE(0x303C, 0x25e, 0xA832);
  254. extern void GXSetViewPortFilter(gxViewPort portOrder, gxUserViewPortFilter filter, long refCon)
  255.  THREEWORDINLINE(0x303C, 0x23e, 0xA832);
  256. /* QD to QD GX Translator functions */
  257. extern void GXInstallQDTranslator(GrafPtr port, gxTranslationOption options, const Rect *srcRect, const Rect *dstRect, Point styleStrech, gxShapeSpoolUPP userFunction, void *reference)
  258.  THREEWORDINLINE(0x303C, 0x23f, 0xA832);
  259. extern gxTranslationStatistic GXRemoveQDTranslator(GrafPtr port, gxTranslationStatistic *statistic)
  260.  THREEWORDINLINE(0x303C, 0x240, 0xA832);
  261. extern gxShape GXConvertPICTToShape(PicHandle pict, gxTranslationOption options, const Rect *srcRect, const Rect *dstRect, Point styleStretch, gxShape destination, gxTranslationStatistic *stats)
  262.  THREEWORDINLINE(0x303C, 0x241, 0xA832);
  263. /* Find the best GX style given a QD font and face. Called by the QD->GX translator */
  264. extern long GXConvertQDFont(gxStyle theStyle, long txFont, long txFace)
  265.  THREEWORDINLINE(0x303C, 0x242, 0xA832);
  266. extern gxConvertQDFontUPP GXGetConvertQDFont(void)
  267.  THREEWORDINLINE(0x303C, 0x243, 0xA832);
  268. extern void GXSetConvertQDFont(gxConvertQDFontUPP userFunction)
  269.  THREEWORDINLINE(0x303C, 0x244, 0xA832);
  270.  
  271. #if defined(__MWERKS__) && GENERATING68K
  272.     #pragma pop
  273. #endif
  274.  
  275. #if PRAGMA_IMPORT_SUPPORTED
  276. #pragma import off
  277. #endif
  278.  
  279. #if PRAGMA_ALIGN_SUPPORTED
  280. #pragma options align=reset
  281. #endif
  282.  
  283. #ifdef __cplusplus
  284. }
  285. #endif
  286.  
  287. #endif /* __GXENVIRONMENT__ */
  288.